package com.bawei.system.remote.api;

import com.bawei.common.core.constant.ServiceNameConstants;
import com.bawei.common.core.domain.R;
import com.bawei.system.remote.factory.RemoteEsDocFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.Map;

/**
 * 全文检索服务
 *
 * @author bawei
 */
@FeignClient(contextId = "remoteEsIndexService", value = ServiceNameConstants.ES_SERVICE, fallbackFactory = RemoteEsDocFallbackFactory.class)
public interface RemoteEsIndexService {
    /**
     * 根据索引名称创建索引
     *
     * @return
     */
    @GetMapping("/create")
    public R<Boolean> indexCreate(String indexName);

    /**
     * 根据索引名称、映射结构创建索引
     *
     * @return
     */
    @GetMapping("/createWithMapping")
    public R<Boolean> indexCreateWithMapping(String indexName, String indexMapping);

    /**
     * 根据索引名称查询索引是否存在
     *
     * @return
     */
    @GetMapping("/indexExit")
    public R<Boolean> indexExit(String indexName);

    /**
     * 根据索引名称删除索引
     *
     * @return
     */
    @GetMapping("/indexDelete")
    public R<Boolean> indexDelete(String indexName);

    /**
     * 根据索引名称获取mapping
     *
     * @return
     */
    @GetMapping("/indexGetMapping")
    public R<Map> indexGetMapping(String indexName);
}
